package com.ruoyi.yf.test;

import org.apache.shiro.codec.Base64;

import javax.crypto.KeyGenerator;
import javax.crypto.SecretKey;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.InetSocketAddress;
import java.net.URL;
import java.net.Proxy;
import java.security.NoSuchAlgorithmException;

public class Client {

    public static void main(String[] args) throws IOException, NoSuchAlgorithmException {


// 使用java.net.Proxy类设置代理IP 114.243.67.243:8118
        Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("27.43.189.132", 9999));
        HttpURLConnection connection = (HttpURLConnection) new URL("http://www.baidu.com/").openConnection(proxy);
        connection.setConnectTimeout(6000); // 6s
        connection.setReadTimeout(6000);
        connection.setUseCaches(false);

        if (connection.getResponseCode() == 200) {
            System.out.println("代理ip连接成功");
        }

        System.exit(1);
        UserManager userManagerImpl = new UserManagerImpl();
        UserManager userManager = new UserManagerImplProxy(userManagerImpl);
        userManager.addUser("1111", "张三");
        userManager.findUser("1111");
    }
}  